package day06_work_a;

public class Test extends Student {
    public static void main(String[] args) throws Exception {
        Student student = new Student();

        try {
            saveAge(224);
        }catch (AgeException e){
            e.printStackTrace();
        }
    }

    public static void saveAge(int age) throws AgeException {
        if (age > 15 && age < 50) {
            System.out.println("年龄保存成功");
        } else {
            throw new AgeException("年龄错误");
        }


    }}